<template>
  <el-card>
    <el-table :data="tableData" style="width: 100%">
      <el-table-column
        v-for="(key, value) in tempData"
        :prop="value"
        :label="value"
        width="180"
      />
    </el-table>
    <!-- <div>
      <div v-for="(key, value) in tempData">{{key}}:{{value}}</div>
    </div> -->
  </el-card>
</template>

<script setup>
import { defineProps, watch, reactive, ref } from "vue";
import { regaList2 } from "@/api/energySystem";
const prop = defineProps({
  listId: Number,
  enterpriseId: String,
});
const tempData = ref([]);

const tableData = ref([]);

let cloumData = {};

const getEnterInfo = () => {
  doDataList();
};
const doDataList = () =>{
  let datas = {
    proId: prop.enterpriseId,
    listId: prop.listId,
  };
  regaList2(datas)
    .then((res) => {
      
      tableData.value = res.rows;
      
      if (res.rows.length > 0) {
        console.log(res.rows[0])
        tempData.value = res.rows[0];
      }
    })
    .catch((msg) => {
      //获取出错
      ElMessage.error("获取token失败，请联系管理员！");
    });
}
/**
 * 监听变化,防止懒加载后无法再次刷新
 */
watch(
  () => prop.enterpriseId,
  (newVal, oldVal) => {
    if (newVal != undefined) {
      doDataList();
    }
  }
);

getEnterInfo();
</script>

<style lang="less" scoped></style>
